www.gusucode.com > 地方成人教育中心整站源代码 1 > 地方成人教育中心整站源代码 1.0/inc/LableFunction.asp

    <%

const const_rule="{idea_loop:(\n|.)*?{/idea_loop}"

'------------验证模板中是否存在非法的分割字符-------------------
Function VertifyErrorWord(ErrorWord,ContentStr)
if instr(1,ContentStr,ErrorWord)>0 then
	VertifyErrorWord=true
else
	VertifyErrorWord=false
end if
End Function

'----------------标签格式验证函数--------------------------------------------------------------------------------------1
'2008/01/19  
Function  VerifyParameterFormat(LableName,LableParameter)
	dim functionlist()
	LableSmallName=lcase(LableName)
	select case LableSmallName
    	case "navigateloop"
			  redim  Preserve functionlist(0)			  
			  functionlist(0)="Integer"
			  if instr("0,1,2",split(LableParameter,",")(0))>0  then
				  if ubound(split(LableParameter,","))=0 then
						if isnumeric(LableParameter)=true  then
							LableParameter=cint(LableParameter)
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(LableParameter)=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
						end if
				  else
						VerifyParameterFormat=false
				  end if
			  else
				  VerifyParameterFormat=false
				  exit Function
			  end if
		case "downloop","productloop","photoloop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=3 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
		case "newsloop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
		case "news01loop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
			case "news02loop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
			case "news03loop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
			case "news04loop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
			case "news05loop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
			case "news06loop"
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=5 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
		case "specialloop" 
			redim  Preserve functionlist(0)			  
			  functionlist(0)="Integer"
			  if ubound(split(LableParameter,","))=0 then
					if isnumeric(LableParameter)=true  then
						LableParameter=cint(LableParameter)
					else
						VerifyParameterFormat=false
						exit Function
					end if
					if typename(LableParameter)=functionlist(0)  then
						VerifyParameterFormat=true
					else
						VerifyParameterFormat=false
					end if
			  else
					VerifyParameterFormat=false
			  end if
		case "linkloop" 
			redim  Preserve functionlist(0) 
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=2 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if			
		case "newslistloop","news01listloop","news02listloop","news03listloop","news04listloop","news05listloop","news06listloop","productlistloop","downlistloop","photolistloop","joblistloop"
			redim  Preserve functionlist(0)	
			functionlist(0)="Integer"
			if instr("0,1",split(LableParameter,",")(0))>0  then
				if ubound(split(LableParameter,","))=3 then
					for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
						if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
							split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
							exit Function
						end if
					next
				else
					VerifyParameterFormat=false
				end if
			else
				VerifyParameterFormat=false
				exit Function
			end if
		case "guestlistloop","aboutloop"
			redim  Preserve functionlist(0)	
			functionlist(0)="Integer"
			if ubound(split(LableParameter,","))=1 then
				for LableParameterCount = 0   to  ubound(split(LableParameter,","))	
					if isnumeric(split(LableParameter,",")(LableParameterCount))=true  then
						split(LableParameter,",")(LableParameterCount)=cint(split(LableParameter,",")(LableParameterCount))	
					else
						VerifyParameterFormat=false
						exit Function
					end if
					if typename(cint(split(LableParameter,",")(LableParameterCount)))=functionlist(0)  then
						VerifyParameterFormat=true
					else
						VerifyParameterFormat=false
						exit Function
					end if
				next
			else
				VerifyParameterFormat=false
			end if	
		case "sortloop"
			  redim  Preserve functionlist(0)			  
			  functionlist(0)="Integer"
			  if instr("0,1,2,3,4,5,6,7,8,9,10,11,12",split(LableParameter,",")(0))>0  then
				  if ubound(split(LableParameter,","))=0 then
						if isnumeric(LableParameter)=true  then
							LableParameter=cint(LableParameter)
						else
							VerifyParameterFormat=false
							exit Function
						end if
						if typename(LableParameter)=functionlist(0)  then
							VerifyParameterFormat=true
						else
							VerifyParameterFormat=false
						end if
				  else
						VerifyParameterFormat=false
				  end if
			  else
				  VerifyParameterFormat=false
				  exit Function
			  end if	
		case else  	   
	end select
End Function

'----------------循环标签解析函数,并用-idea-分隔---------------------------
'2008/01/19  
Function  LableAnalysis(ContentStr,RuleStr)
	set regEx = new RegExp 
	regEx.Pattern=RuleStr 
	regEx.IgnoreCase = True 
	regEx.Global = True 
	if VertifyErrorWord("-idea-",ContentStr)=true then
		response.Write("存在非法字符无法解析")
		response.End()
	end if	
	
	Set Matches=regEx.Execute(ContentStr)
	For Each Matche In Matches   
		 ArrayStr=ArrayStr&Matche&"-idea-"
	next	
	LableArray=split(ArrayStr,"-idea-")		
	for IdeaLableCount =0 to ubound(LableArray)-1
		Position_1=instr(1,LableArray(IdeaLableCount),":")
		Position_2=instr(1,LableArray(IdeaLableCount)," ")
		Position_3=instr(1,LableArray(IdeaLableCount),"}")
		Position_4=instr(1,LableArray(IdeaLableCount),"{/idea_loop}")
		Str_Function=mid(LableArray(IdeaLableCount),Position_1+1,Position_2-Position_1-1)	
		Str_Parameter=mid(LableArray(IdeaLableCount),Position_2+1,Position_3-Position_2-1)
		Str_InnerHtml=mid(LableArray(IdeaLableCount),Position_3+1,Position_4-Position_3-1)
		'---------------------------验证标签参数的格式
		if  VerifyParameterFormat(Str_Function,Str_Parameter)=true  then
			LableArray(IdeaLableCount)=LableArray(IdeaLableCount)&"-idea-"&Str_Function&"-idea-"&Str_Parameter&"-idea-"&Str_InnerHtml		
		else
			LableArray(IdeaLableCount)=LableArray(IdeaLableCount)&"-idea-"&"此标签格式错误"	
		end if
	next
	LableAnalysis=LableArray
End Function

'-----------------标签循环体中变量-------------------------------------------------------------------------------------3
Function ViewVariableInLable(LableName)
	LableSmallName=lcase(LableName)
	select case LableSmallName
    	case "navigateloop"
			ViewVariableInLable=array("{ng_url}","{ng_opentype}","{ng_name}")
		case "downloop"
			ViewVariableInLable=array("{down_name}","{down_ID}","{down_num}")
		case "productloop"
			ViewVariableInLable=array("{product_name}","{product_ID}","{product_pic}")
		case "photoloop"
			ViewVariableInLable=array("{photo_name}","{photo_url}","{photo_pic}","{photo_info}")
		case "newsloop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "news01loop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "news02loop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "news03loop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "news04loop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "news05loop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "news06loop"
			ViewVariableInLable=array("{news_name}","{news_ID}","{news_pic}","{news_mcontent}","{news_num}","{news_date}")
		case "specialloop"
			ViewVariableInLable=array("{special_name}","{special_url}","{special_pic}")
		case "linkloop"
			ViewVariableInLable=array("{link_name}","{link_url}","{link_pic}")				
		case "newslistloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")	
		case "news01listloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")
		case "news02listloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")
		case "news03listloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")
		case "news04listloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")
		case "news05listloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")
		case "news06listloop"
			ViewVariableInLable=array("{news_name}","{news_date}","{news_content}","{news_url}")
		case "productlistloop"
			ViewVariableInLable=array("{product_name}","{product_pic}","{product_url}")
		case "downlistloop"
			ViewVariableInLable=array("{down_name}","{down_hits}","{down_url}","{down_date}","{down_language}","{down_accmode}","{down_content}")
		case "photolistloop"
			ViewVariableInLable=array("{photo_name}","{photo_lpic}","{photo_pic}")
		case "joblistloop"
			ViewVariableInLable=array("{job_name}","{job_url}","{job_address}","{job_num}","{job_enddate}")	
		case "guestlistloop"
			ViewVariableInLable=array("{guest_book}")					
		case "sortloop"
			ViewVariableInLable=array("{sort_id}","{sort_name}")
		case "aboutloop"
			ViewVariableInLable=array("{about_content}")	
		case else  
	end select   
End Function

'----------------navigateloop标签对应函数---------------------------
Function navigateloop(ItemNumber,LoopHtml)
	If CInt(ItemNumber) = 0 Then
	    sql="select * from Idea_Navigation where IsShow="&GetState()&" order by Sequence"
		set rs=idea.exec(sql,1)
		do while  not rs.eof
			LoopHtml_1=replace(LoopHtml,ViewVariableInLable("navigateloop")(0),rs("NavUrl"))
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("navigateloop")(1),rs("OpenType"))
			LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("navigateloop")(2),rs("NavName"))
			Total_LoopHtml=Total_LoopHtml&LoopHtml_3
			rs.movenext		 
		loop 
		rs.close()
		set rs=nothing
	ElseIf CInt(ItemNumber) = 1 Then
		sql="select * from Idea_Navigation where IsShow="&GetState()&" order by Sequence"
		set rs=idea.exec(sql,1)
		for i=0 to rs.recordcount-2
			LoopHtml_1=replace(LoopHtml,ViewVariableInLable("navigateloop")(0),rs("NavUrl"))
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("navigateloop")(1),rs("OpenType"))
			LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("navigateloop")(2),rs("NavName"))
			Total_LoopHtml=Total_LoopHtml&LoopHtml_3
			rs.movenext		 
		next 
		rs.close()
		set rs=nothing
	ElseIf CInt(ItemNumber) = 2 Then
		sql="select top 1 * from Idea_Navigation where IsShow="&GetState()&" order by Sequence desc"
		set rs=idea.exec(sql,1)
		do while  not rs.eof
			LoopHtml_1=replace(LoopHtml,ViewVariableInLable("navigateloop")(0),rs("NavUrl"))
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("navigateloop")(1),rs("OpenType"))
			LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("navigateloop")(2),rs("NavName"))
			Total_LoopHtml=Total_LoopHtml&LoopHtml_3
			rs.movenext		 
		loop 
		rs.close()
		set rs=nothing	
	End If
	navigateloop=Total_LoopHtml	
End Function

'----------------aboutloop标签对应函数---------------------------
Function aboutloop(ItemNumber,LoopHtml)
	sql="Select * from Idea_About where IsShow="&GetState()&" and ID="&cint(split(ItemNumber,",")(0))
	set rs=idea.exec(sql,1)
	do while not rs.eof
	    if len(rs("Content"))>cint(split(ItemNumber,",")(1)) then
		    str=left(rs("Content"),cint(split(ItemNumber,",")(1)))+"…"
		else
		    str=left(rs("Content"),cint(split(ItemNumber,",")(1)))
		end if
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("aboutloop")(0),str)
		Total_LoopHtml=Total_LoopHtml&LoopHtml_1
		rs.movenext	 
	loop 
	rs.close()
	set rs=nothing	
	aboutloop=Total_LoopHtml	
End Function

'----------------downloop标签对应函数---------------------------
Function downloop(ItemNumber,LoopHtml)
	if cint(split(ItemNumber,",")(0))=0 then
	    sql_1=" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		sql_1=" order by Hits desc"
	end if
	if cint(split(ItemNumber,",")(1))=0 then
	    sql_2=sql_1
	else
		sql_2=" and SortID="&cint(split(ItemNumber,",")(1))&sql_1
	end if	
	sql="select top "&cint(split(ItemNumber,",")(2))&" * from Idea_Down where IsShow="&GetState()&sql_2	
	set rs=idea.exec(sql,1)
	i=1
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("downloop")(0),gotTopic(rs("DownName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("downloop")(1),rs("ID"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("downloop")(2),i)
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext	
		i=i+1	 
	loop 
	rs.close()
	set rs=nothing	
	downloop=Total_LoopHtml	
End Function

'----------------productloop标签对应函数---------------------------
Function productloop(ItemNumber,LoopHtml)
	if cint(split(ItemNumber,",")(0))=0 then
	    sql_1=" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		sql_1=" order by Hits desc"
	end if
	if cint(split(ItemNumber,",")(1))=0 then
	    sql_2=sql_1
	else
		sql_2=" and SortID="&cint(split(ItemNumber,",")(1))&sql_1
	end if	
	sql="select top "&cint(split(ItemNumber,",")(2))&" * from Idea_Product where IsShow="&GetState()&sql_2	
	set rs=idea.exec(sql,1)
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("productloop")(0),gotTopic(rs("ProductName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("productloop")(1),rs("ID"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("productloop")(2),rs("sProductPic"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext		 
	loop 
	rs.close()
	set rs=nothing	
	productloop=Total_LoopHtml	
End Function

'----------------photoloop标签对应函数---------------------------
Function photoloop(ItemNumber,LoopHtml)
	if cint(split(ItemNumber,",")(0))=0 then
	    sql_1=" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		sql_1=" order by Hits desc"
	end if
	if cint(split(ItemNumber,",")(1))=0 then
	    sql_2=sql_1
	else
		sql_2=" and SortID="&cint(split(ItemNumber,",")(1))&sql_1
	end if	
	sql="select top "&cint(split(ItemNumber,",")(2))&" * from Idea_Photo where IsShow="&GetState()&sql_2	
	set rs=idea.exec(sql,1)
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("photoloop")(0),gotTopic(rs("PhotoName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("photoloop")(1),rs("PhotoPic"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("photoloop")(2),rs("sPhotoPic"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("photoloop")(3),rs("Describe"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext		 
	loop 
	rs.close()
	set rs=nothing	
	photoloop=Total_LoopHtml	
End Function

'----------------newsloop标签对应函数---------------------------
Function newsloop(ItemNumber,LoopHtml)
	if cint(split(ItemNumber,",")(1))=0 then
	    sql="Select top "&cint(split(ItemNumber,",")(2))&" * from Idea_News where IsShow="&GetState()&""
	else
		sql="Select top "&cint(split(ItemNumber,",")(2))&" * from Idea_News where IsShow="&GetState()&" and sNewsPic<>''"
	end if
	if cint(split(ItemNumber,",")(5))<>0 then
	    sql=sql+" and SortID="&cint(split(ItemNumber,",")(5))&""
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    sql=sql+" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		sql=sql+" order by Hits desc"
	end if
	set rs=idea.exec(sql,1)
	i=1
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("newsloop")(0),gotTopic(rs("NewsName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("newsloop")(1),rs("ID"))
		if cint(split(ItemNumber,",")(1))=0 then
			LoopHtml_3=LoopHtml_2
		else
			LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("newsloop")(2),rs("sNewsPic"))
		end if
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("newsloop")(3),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(4))))
		LoopHtml_5=replace(LoopHtml_4,ViewVariableInLable("newsloop")(4),i)
		LoopHtml_6=replace(LoopHtml_5,ViewVariableInLable("newsloop")(5),DatePart("yyyy",rs("AddDate"))&"/"&DatePart("m",rs("AddDate"))&"/"&DatePart("d",rs("AddDate")))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_6
		rs.movenext	
		i=i+1	 
	loop 
	rs.close()
	set rs=nothing	
	newsloop=Total_LoopHtml	
End Function

'----------------specialloop标签对应函数---------------------------
Function specialloop(ItemNumber,LoopHtml)
	sql_1=" order by ID desc"	
	sql="select top "&cint(ItemNumber)&" * from Idea_Special where IsShow="&GetState()&sql_1	
	set rs=idea.exec(sql,1)
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("specialloop")(0),rs("SpecialName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("specialloop")(1),rs("SpecialUrl"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("specialloop")(2),rs("SpecialPic"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext		 
	loop 
	rs.close()
	set rs=nothing	
	specialloop=Total_LoopHtml	
End Function

'----------------linkloop标签对应函数---------------------------
Function linkloop(ItemNumber,LoopHtml)
	if cint(split(ItemNumber,",")(0))=0 then
	    sql_1=" and LinkType<>"&GetState()&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		sql_1=" and LinkType="&GetState()&" order by ID desc"
	end if
	sql="select top "&cint(split(ItemNumber,",")(1))&" * from Idea_Link where IsShow="&GetState()&sql_1	
	set rs=idea.exec(sql,1)
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("linkloop")(0),gotTopic(rs("SiteName"),cint(split(ItemNumber,",")(2))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("linkloop")(1),rs("SiteUrl"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("linkloop")(2),rs("SiteLogo"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext		 
	loop 
	rs.close()
	set rs=nothing	
	linkloop=Total_LoopHtml	
End Function

'----------------newslistloop标签对应函数---------------------------
Function newslistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_News where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		newslistloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("newslistloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("newslistloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("newslistloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("newslistloop")(3),"NewsShow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	newslistloop=Total_LoopHtml	
End Function

'----------------news01listloop标签对应函数---------------------------
Function news01listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_News01 where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		news01listloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("news01listloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("news01listloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("news01listloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("news01listloop")(3),"jspxshow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	news01listloop=Total_LoopHtml	
End Function

'----------------news02listloop标签对应函数---------------------------
Function news02listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_news02 where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		news02listloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("news02listloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("news02listloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("news02listloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("news02listloop")(3),"xljyshow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	news02listloop=Total_LoopHtml	
End Function

'----------------news03listloop标签对应函数---------------------------
Function news03listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_news03 where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		news03listloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("news03listloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("news03listloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("news03listloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("news03listloop")(3),"yspyshow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	news03listloop=Total_LoopHtml	
End Function

'----------------news04listloop标签对应函数---------------------------
Function news04listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_news04 where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		news04listloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("news04listloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("news04listloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("news04listloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("news04listloop")(3),"jxglshow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	news04listloop=Total_LoopHtml	
End Function

'----------------news05listloop标签对应函数---------------------------
Function news05listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_news05 where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		news05listloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("news05listloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("news05listloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("news05listloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("news05listloop")(3),"xsyjshow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	news05listloop=Total_LoopHtml	
End Function

'----------------news06listloop标签对应函数---------------------------
Function news06listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_news06 where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and NewsName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		news06listloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("news06listloop")(0),rs("NewsName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("news06listloop")(1),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("news06listloop")(2),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("news06listloop")(3),"xkjsshow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_4
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	news06listloop=Total_LoopHtml	
End Function

'----------------productlistloop标签对应函数---------------------------
Function productlistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_Product where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and ProductName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		productlistloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("Productlistloop")(0),gotTopic(rs("ProductName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("Productlistloop")(1),rs("lProductPic"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("Productlistloop")(2),"ProductShow.asp?id="&rs("Id"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	productlistloop=Total_LoopHtml	
End Function

'----------------Downlistloop标签对应函数---------------------------
Function Downlistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_Down where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and DownName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		Downlistloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("Downlistloop")(0),rs("DownName"))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("Downlistloop")(1),rs("Hits"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("Downlistloop")(2),"DownShow.asp?id="&rs("Id"))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("Downlistloop")(3),DatePart("yyyy",rs("AddDate"))&"-"&DatePart("m",rs("AddDate"))&"-"&DatePart("d",rs("AddDate")))
		LoopHtml_5=replace(LoopHtml_4,ViewVariableInLable("Downlistloop")(4),rs("Language"))
		LoopHtml_6=replace(LoopHtml_5,ViewVariableInLable("Downlistloop")(5),rs("Accmode"))
		LoopHtml_7=replace(LoopHtml_6,ViewVariableInLable("Downlistloop")(6),gotTopic(RemoveHTML(rs("Content")),cint(split(ItemNumber,",")(3))))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_7
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	Downlistloop=Total_LoopHtml	
End Function

'----------------Photolistloop标签对应函数---------------------------
Function Photolistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	Sql="select * from Idea_Photo where IsShow="&GetState()
	if CurrentSort<>"" then
	    if not IsNumeric(CurrentSort) then
			Exit Function
		else
			Sql=Sql&" and SortID="&CurrentSort&""
		end if
	end if
	if Keyword<>"" then
		Sql=Sql&" and PhotoName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		Photolistloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("Photolistloop")(0),gotTopic(rs("PhotoName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("Photolistloop")(1),rs("lPhotoPic"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("Photolistloop")(2),rs("PhotoPic"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_3
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	Photolistloop=Total_LoopHtml	
End Function

'----------------Joblistloop标签对应函数---------------------------
Function Joblistloop(ItemNumber,LoopHtml,Keyword,CurrentPage)
	Sql="select * from Idea_Jobs where IsShow="&GetState()
	if Keyword<>"" then
		Sql=Sql&" and JobName like '%"&Keyword&"%'"
	end if
	if cint(split(ItemNumber,",")(0))=0 then
	    Sql=Sql&" order by ID desc"
	elseif cint(split(ItemNumber,",")(0))=1 then
		Sql=Sql&" order by Hits desc"
	end if
	session("PageSize")=cint(split(ItemNumber,",")(1))
	session("PageLength")=cint(split(ItemNumber,",")(2))
	if CurrentPage<1 or CurrentPage="" then CurrentPage=1
	set rs=idea.exec(sql,1)
	rs.pagesize=cint(split(ItemNumber,",")(1))
	if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
	if CurrentPage=0 then
		Joblistloop="没有相关信息"
		exit function
	Else
		rs.absolutepage=CurrentPage
	end if
	for i=1 to rs.pagesize
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("Joblistloop")(0),gotTopic(rs("JobName"),cint(split(ItemNumber,",")(3))))
		LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("Joblistloop")(1),"JobShow.asp?ID="&rs("ID"))
		LoopHtml_3=replace(LoopHtml_2,ViewVariableInLable("Joblistloop")(2),rs("JobAddress"))
		LoopHtml_4=replace(LoopHtml_3,ViewVariableInLable("Joblistloop")(3),rs("JobNum"))
		LoopHtml_5=replace(LoopHtml_4,ViewVariableInLable("Joblistloop")(4),rs("EndDate"))
		Total_LoopHtml=Total_LoopHtml&LoopHtml_5
		rs.movenext
		if rs.eof then
			exit for
		end if		 
	next
	rs.close()
	set rs=nothing	
	Joblistloop=Total_LoopHtml	
End Function

'----------------guestlistloop标签对应函数---------------------------
Function guestlistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	if CurrentSort="" then
		if idea_20=1 then
			Sql="Select * from Idea_GuestBook where IsShow="&GetState()&""
		else
			Sql="Select * from Idea_GuestBook"
		end if
		if Keyword<>"" then
			Sql=Sql&" and Content like '%"&Keyword&"%'"
		end if
		Sql=Sql&" order by ID desc"
		session("PageSize")=cint(split(ItemNumber,",")(0))
		session("PageLength")=cint(split(ItemNumber,",")(1))
		if CurrentPage<1 or CurrentPage="" then CurrentPage=1
		set rs=idea.exec(Sql,1)
		rs.pagesize=cint(split(ItemNumber,",")(0))
		if CurrentPage>rs.pagecount then CurrentPage=rs.pagecount
		if CurrentPage=0 then
			guestlistloop="没有相关信息"
			exit function
		Else
			rs.absolutepage=CurrentPage
		end if
		for i=1 to rs.pagesize
			str=str&"<div class='guest_ctr'>"
			str=str&"<div class='guest_xx1'>姓名:["&rs("MesTitle")&"] &nbsp;&nbsp;"&rs("AddTime")&"</div>"
			str=str&"<div class='guest_ctt'>内容:"&rs("Content")&"</div>"
			if rs("ReplyContent")<>"" then
				str=str&"<div class='guest_xx2'>回复:"&rs("ReplyContent")&"</div>"
			end if
			str=str&"</div>"
			rs.movenext
			if rs.eof then
				exit for
			end if		 
		next
		rs.close()
		set rs=nothing
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("guestlistloop")(0),str)
		Total_LoopHtml=Total_LoopHtml&LoopHtml_1
	elseif CurrentSort="签写留言" then
		str=str&"<form id='Add' name='Add' method='post' action='?action=add'>"
		str=str&"<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
		str=str&"<tr>"
		str=str&"<td width='10%' height='30' align='right'>姓名:</td>"
		str=str&"<td width='88%'><input name='MesTitle' type='text' id='MesTitle' size='40' onblur='check_MesTitle(this.value)' class='input_text'/>&nbsp;<span id='span_MesTitle'>*</span></td>"
		str=str&"</tr>"
		str=str&"<tr>"
		str=str&"<td height='30' align='right'>电话:</td>"
		str=str&"<td><input name='LinkName' type='text' id='LinkName' size='40' onblur='check_LinkName(this.value)' class='input_text'/>&nbsp;<span id='span_LinkName'>*</span></td>"
		str=str&"</tr>"
		str=str&"<tr>"
		str=str&"<td height='150' align='right'>内容:</td>"
		str=str&"<td><textarea name='Content' cols='50' rows='10' id='Content' onblur='check_Content(this.value)' class='input_text'></textarea>&nbsp;<span id='span_Content'>*</span></td>"
		str=str&"</tr>"
		str=str&"<tr>"
		str=str&"<td height='30' align='right'>验证码:</td>"
		str=str&"<td><input name='yzm' type='text' id='yzm' class='input_text' style='width:60px;'> <img src='inc/code.asp' alt='验证码' /></td>"
		str=str&"</tr>"
		str=str&"<tr>"
		str=str&"<td height='35' align='right'>&nbsp;</td>"
		str=str&"<td><input type='submit' name='Btn_OK' id='Btn_OK' value='提交' disabled='disabled' class='button'/>&nbsp;&nbsp;"
		str=str&"<input type='reset' name='Submit2' value='重置' class='button'/></td>"
		str=str&"</tr>"
		str=str&"</table>"
		str=str&"</form>"
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("guestlistloop")(0),str)
		Total_LoopHtml=Total_LoopHtml&LoopHtml_1
	end if	
	guestlistloop=Total_LoopHtml	
End Function

'----------------sortloop标签对应函数---------------------------
Function sortloop(ItemNumber,LoopHtml)
	if CInt(ItemNumber)=0 then
	    sql_1=" Idea_NewsSort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=1 then
		sql_1=" Idea_ProductSort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=2 then
		sql_1=" Idea_DownSort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=3 then
		sql_1=" Idea_PhotoSort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=4 then
		sql_1=" Idea_About where IsShow="&GetState()&" order by Sequence"
	elseif CInt(ItemNumber)=5 then
		sql_1=" Idea_Solution where IsShow="&GetState()&" order by Sequence"
	elseif CInt(ItemNumber)=6 then
		sql_1=" Idea_Jiameng where IsShow="&GetState()&" order by Sequence"			
	elseif CInt(ItemNumber)=7 then
	    sql_1=" Idea_News01Sort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=8 then
	    sql_1=" Idea_News02Sort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=9 then
	    sql_1=" Idea_News03Sort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=10 then
	    sql_1=" Idea_News04Sort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=11 then
	    sql_1=" Idea_News05Sort where IsShow="&GetState()&" order by ID"
	elseif CInt(ItemNumber)=12 then
	    sql_1=" Idea_News06Sort where IsShow="&GetState()&" order by ID"
	end if	
	sql="select * from"&sql_1
	set rs=idea.exec(sql,1)
	do while not rs.eof
		LoopHtml_1=replace(LoopHtml,ViewVariableInLable("sortloop")(0),rs("ID"))
		if CInt(ItemNumber)=4 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("AboutName"))
		elseif CInt(ItemNumber)=5 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("SolutionName"))
	    elseif CInt(ItemNumber)=6 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("JiamengName"))
		elseif CInt(ItemNumber)=7 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("sortname"))
		elseif CInt(ItemNumber)=8 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("sortname"))
		elseif CInt(ItemNumber)=9 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("sortname"))
		elseif CInt(ItemNumber)=10 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("sortname"))
		elseif CInt(ItemNumber)=11 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("sortname"))
		elseif CInt(ItemNumber)=12 then
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("sortname"))
		else
			LoopHtml_2=replace(LoopHtml_1,ViewVariableInLable("sortloop")(1),rs("SortName"))
		end if	
		Total_LoopHtml=Total_LoopHtml&LoopHtml_2
		rs.movenext
	loop 
	rs.close()
	set rs=nothing	
	sortloop=Total_LoopHtml	
End Function

'-----------------生成所有标签-------------------------------------------------------------------------------------------------2
'标签名称  整个标签体  模板文件内容  标签参数   标签循环体内容
Function MakeAllLable(LableName,TotalLableHtml,ContentStr,ItemNumber,LoopHtml)
	LableSmallName=lcase(LableName)
	select case LableSmallName
    	case "navigateloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,navigateloop(ItemNumber,LoopHtml))
		case "sortloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,sortloop(ItemNumber,LoopHtml))	
		case "downloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,downloop(ItemNumber,LoopHtml))
		case "photoloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,photoloop(ItemNumber,LoopHtml))
		case "productloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,productloop(ItemNumber,LoopHtml))
		case "newsloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,newsloop(ItemNumber,LoopHtml))
		case "news01loop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,news01loop(ItemNumber,LoopHtml))
		case "news02loop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,news02loop(ItemNumber,LoopHtml))
		case "news03loop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,news03loop(ItemNumber,LoopHtml))
		case "news04loop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,news04loop(ItemNumber,LoopHtml))
		case "news05loop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,news05loop(ItemNumber,LoopHtml))
		case "news06loop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,news06loop(ItemNumber,LoopHtml))
		case "specialloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,specialloop(ItemNumber,LoopHtml))
		case "linkloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,linkloop(ItemNumber,LoopHtml))
		case "aboutloop"
			MakeAllLable=replace(ContentStr,TotalLableHtml,aboutloop(ItemNumber,LoopHtml))				
		case else  
	end select  
End Function

'-----------------生成List所有标签-------------------------------------------------------------------------------------------------2
'标签名称  整个标签体  模板文件内容  标签参数   标签循环体内容
Function MakeAllLable_List(LableName,TotalLableHtml,ContentStr,ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage)
	LableSmallName=lcase(LableName)
	select case LableSmallName
	    case "navigateloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,navigateloop(ItemNumber,LoopHtml))
		case "sortloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,sortloop(ItemNumber,LoopHtml))
		case "newslistloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,newslistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "news01listloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,news01listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "news02listloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,news02listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "news03listloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,news03listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "news04listloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,news04listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "news05listloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,news05listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "news06listloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,news06listloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "productlistloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,productlistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))
		case "downlistloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,downlistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))	
		case "photolistloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,photolistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))	
		case "joblistloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,joblistloop(ItemNumber,LoopHtml,Keyword,CurrentPage))
		case "guestlistloop"
			MakeAllLable_List=replace(ContentStr,TotalLableHtml,guestlistloop(ItemNumber,LoopHtml,CurrentSort,Keyword,CurrentPage))		
		case else  
	end select  
End Function

'----------------解析某个模板的所有loop标签,返回生成的html---------------
Function GetAllHtml(ContentStr,RuleStr)
	ContentStr_1=ContentStr
	LableArray_2=LableAnalysis(ContentStr_1,RuleStr)
	for LableCount=0 to ubound(LableArray_2)-1
		Array_LableAnalysis=split(LableArray_2(LableCount),"-idea-")
		if  ubound(Array_LableAnalysis)=3 then
			ContentStr_1=MakeAllLable(Array_LableAnalysis(1),Array_LableAnalysis(0),ContentStr_1,Array_LableAnalysis(2),Array_LableAnalysis(3))
		else
			ContentStr_1=replace(ContentStr_1,Array_LableAnalysis(0),"此标签参数格式错误")
		end if	
	Next
	GetAllHtml=ContentStr_1
End Function 

'----------------解析某个List模板的所有loop标签,返回生成的html---------------
Function GetAllHtml_List(ContentStr,RuleStr,CurrentSort,Keyword,CurrentPage)
	ContentStr_1=ContentStr
	LableArray_2=LableAnalysis(ContentStr_1,RuleStr)
	for LableCount=0 to ubound(LableArray_2)-1
		Array_LableAnalysis=split(LableArray_2(LableCount),"-idea-")
		if  ubound(Array_LableAnalysis)=3 then
			ContentStr_1=MakeAllLable_List(Array_LableAnalysis(1),Array_LableAnalysis(0),ContentStr_1,Array_LableAnalysis(2),Array_LableAnalysis(3),CurrentSort,Keyword,CurrentPage)
		else
			ContentStr_1=replace(ContentStr_1,Array_LableAnalysis(0),"此标签参数格式错误")
		end if	
	Next
	GetAllHtml_List=ContentStr_1
End Function 

'-----------替换所有全局标签----------
Function ReplaceGlobalLable(ContentStr)
	GlobalLableArray=array("{idea_sitename}","{idea_Keywords}","{idea_Description}","{idea_Company}","{idea_Icp}","{idea_Email}","{idea_Phone}","{idea_Addr}")
	ContentStr=replace(ContentStr,GlobalLableArray(0),idea_1)
	ContentStr=replace(ContentStr,GlobalLableArray(1),idea_18)
	ContentStr=replace(ContentStr,GlobalLableArray(2),idea_19)
	ContentStr=replace(ContentStr,GlobalLableArray(3),idea_11)
    ContentStr=replace(ContentStr,GlobalLableArray(4),idea_16)
	ContentStr=replace(ContentStr,GlobalLableArray(5),idea_15)
	ContentStr=replace(ContentStr,GlobalLableArray(6),idea_14)
	ContentStr=replace(ContentStr,GlobalLableArray(7),idea_12)
	ReplaceGlobalLable=ContentStr
End Function

'-------------排列的分页码------------------
Function MakePageNumber(CurrentPage,BeforePages,ViewPageCount,TotalPages,PageType,CurrentSort)
	
	if  CurrentPage<1  then
		CurrentPage=1
	elseif CurrentPage>TotalPages then
		CurrentPage=TotalPages
	end if
	
	if ViewPageCount>TotalPages then
		ViewPageCount=TotalPages
	end if
		
	if CurrentPage-BeforePages<1 then
		BeginPage=1
		EndPage=ViewPageCount
	elseif CurrentPage+ViewPageCount-BeforePages>TotalPages  then
		BeginPage=TotalPages-ViewPageCount+1
		EndPage=TotalPages
	else 
		BeginPage=CurrentPage-BeforePages
		EndPage=CurrentPage-BeforePages+ViewPageCount-1
	end if	
	
	for PageNumber=BeginPage  to  EndPage
	if PageNumber=1 then
		PageNumber2=1
	else
		PageNumber2=PageNumber
	end if
		if PageNumber=CurrentPage then
			StrPageNumber=StrPageNumber&"<span>"&PageNumber&"</span>"&"&nbsp;"
		else
		   if PageType="html" then
				StrPageNumber=StrPageNumber&"<a href=index"&PageNumber2&".html>"&PageNumber&"</a>&nbsp;"
		   elseif PageType="asp" Then
				StrPageNumber=StrPageNumber&"<a href=?SortID="&CurrentSort&"&page="&PageNumber2&">"&PageNumber&"</a>&nbsp;"
		   end if
		end if	
	next
	MakePageNumber=StrPageNumber
End Function

'-------------排列的分页码1------------------
Function MakePageNumber1(CurrentPage,BeforePages,ViewPageCount,TotalPages,PageType)
	
	if  CurrentPage<1  then
		CurrentPage=1
	elseif CurrentPage>TotalPages then
		CurrentPage=TotalPages
	end if
	
	if ViewPageCount>TotalPages then
		ViewPageCount=TotalPages
	end if
		
	if CurrentPage-BeforePages<1 then
		BeginPage=1
		EndPage=ViewPageCount
	elseif CurrentPage+ViewPageCount-BeforePages>TotalPages  then
		BeginPage=TotalPages-ViewPageCount+1
		EndPage=TotalPages
	else 
		BeginPage=CurrentPage-BeforePages
		EndPage=CurrentPage-BeforePages+ViewPageCount-1
	end if	
	
	for PageNumber=BeginPage  to  EndPage
	if PageNumber=1 then
		PageNumber2=1
	else
		PageNumber2=PageNumber
	end if
		if PageNumber=CurrentPage then
			StrPageNumber=StrPageNumber&"<span>"&PageNumber&"</span>"&"&nbsp;"
		else
		   if PageType="html" then
				StrPageNumber=StrPageNumber&"<a href=index"&PageNumber2&".html>"&PageNumber&"</a>&nbsp;"
		   elseif PageType="asp" Then
				StrPageNumber=StrPageNumber&"<a href=?page="&PageNumber2&">"&PageNumber&"</a>&nbsp;"
		   end if
		end if	
	next
	MakePageNumber1=StrPageNumber
End Function
%>